<script type="text/javascript" src="//www.google.com/jsapi"></script>
<script type="text/javascript" src="<%= root_path %>benchmarks/javascripts/chartkick.js"></script>

<header class="row">
  <div class="col-md-6">
    <h3>Benchmarks</h3>
  </div>

  <div class="col-md-6">
    <form method="POST" class="warning-messages" action="<%= root_path %>benchmarks/remove_all">
      <%= csrf_tag %>
      <div class="pull-right">
        <button class="btn btn-danger" type="submit" name="clear" value="1" data-confirm="<%= t('AreYouSure') %>"><%= t('DeleteAll') %></button>
      </div>
    </form>
  </div>
</header>

<% @types.each do |type| %>
<section>
  <div class="row">
    <div class="col-md-6">
      <h4><%= type %></h4>
    </div>
    <div class="col-md-6">
      <form method="POST" class="warning-messages" action="<%= root_path %>benchmarks/remove">
        <%= csrf_tag %>
        <div class="pull-right">
          <input type="hidden" name="type" value="<%= type %>"/>
          <button class="btn btn-danger" type="submit" name="clear" value="1" data-confirm="<%= t('AreYouSure') %>"><%= t('Delete') %></button>
        </div>
      </form>
    </div>
  </div>
  <figure class="row">
    <div class="col-md-7">
      <h5>Amount of tasks by execution time</h5>
      <%= column_chart @charts[type][:stats], library: { hAxis: { title: "Execution time (s)" }, vAxis: { title: "Tasks" } } %>
    </div>
    <div class="col-md-5">
      <h5>Average execution time</h5>
      <%= pie_chart @charts[type][:total] %>
    </div>
  </figure>
</section>
<% end %>
